package md.lanjing.com.module_deal_center.ui.adapter;

import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;


import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;


import java.util.List;

import md.lanjing.com.module_deal_center.R;
import md.lanjing.com.module_deal_center.bean.DealCenterBuyListResponce;


public class BuyListAdapter extends BaseQuickAdapter<DealCenterBuyListResponce.DataBean,BaseViewHolder> {


    public BuyListAdapter(int layoutResId, @Nullable List<DealCenterBuyListResponce.DataBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, DealCenterBuyListResponce.DataBean item) {
        helper.setText(R.id.tv_order_number,"单号:"+item.getId())
                .setText(R.id.tv_number,"CAWD".equals(item.getType())?"CAWD数量："+item.getTokenNum():"USDT数量："+item.getTokenNum())
                .setText(R.id.tv_per_price,"单价："+item.getCnyPrice()+"CNY")
                .setText(R.id.tv_total_count,"总价："+item.getTokenNum()+"CNY")
                .setText(R.id.tv_left_number,"剩余："+item.getStockTokenNum());

        ImageView wxView = helper.getView(R.id.iv_weixin);
        ImageView cardView = helper.getView(R.id.iv_card);
        ImageView aliView = helper.getView(R.id.iv_ali);

        //0代表不支持 1-支持
        if (item.getAliPay()==1){
            aliView.setVisibility(View.VISIBLE);
        }else {
            aliView.setVisibility(View.GONE);
        }

        if (item.getWeChat()==1){
            wxView.setVisibility(View.VISIBLE);
        }else {
            wxView.setVisibility(View.GONE);
        }
        if (item.getBank()==1){
            cardView.setVisibility(View.VISIBLE);
        }else {
            cardView.setVisibility(View.GONE);
        }

    }
}
